//
//  Tiger.m
//  KVO
//
//  Created by apple on 15/9/3.
//  Copyright (c) 2015年 戴维营. All rights reserved.
//

#import "Tiger.h"

@implementation Tiger


+(instancetype)tigerWithName:(NSString *)name weight:(float)weight
{
    Tiger *tiger = [Tiger new];
    tiger.name = name;
    tiger.weight = weight;
    
    return tiger;
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
    NSLog(@"keyPath:%@",keyPath);//被观察的属性
    
    NSLog(@"object: %@",object);//被观察的对象
    
    NSLog(@"change: %@",change);//被观察的内容
    
//    kind
    NSLog(@"%@",change[NSKeyValueChangeKindKey]);
    
//    new
    NSLog(@"%@",change[NSKeyValueChangeNewKey]);
    
//    old
    NSLog(@"%@",change[NSKeyValueChangeOldKey]);

}

@end
